//
// Created by lenovo on 25-5-7.
//
#include "iostream"
using namespace std;

class MyInteger{
    friend ostream &operator<<(ostream &cout,MyInteger myInteger);
public:
    MyInteger()
    {
        m_Num=0;
    }
    //前置++
    MyInteger& operator++()//返回引用一直在对一个数据进行操作
    {
        m_Num++;
        return *this;
    }

    MyInteger operator++(int)//int 为占位参数，用于区分前置或后置递增 后置返回值
    {
        MyInteger temp = *this;//局部对象
        m_Num++;
        return temp;
    }
private:
    int m_Num;
};

ostream &operator<<(ostream& cout,MyInteger myInteger)
{
    cout<<myInteger.m_Num;
    return cout;
}
void test01()
{
    MyInteger myInteger;
    cout<<++myInteger<<endl;
}
void test02()
{
    MyInteger myInteger;
    cout<<myInteger++<<endl;
    cout<<myInteger<<endl;
}
int main()
{
    test02();
    return 0;
}
